/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "project")
@NamedQueries({
    @NamedQuery(name = "Project.findAll", query = "SELECT p FROM Project p"),
    @NamedQuery(name = "Project.findByPId", query = "SELECT p FROM Project p WHERE p.pId = :pId"),
    @NamedQuery(name = "Project.findByPDescription", query = "SELECT p FROM Project p WHERE p.pDescription = :pDescription"),
    @NamedQuery(name = "Project.findByPName", query = "SELECT p FROM Project p WHERE p.pName = :pName"),
    @NamedQuery(name = "Project.findByPProperty", query = "SELECT p FROM Project p WHERE p.pProperty = :pProperty")})
public class Project implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "p_id")
    private Integer pId;
    @Column(name = "p_description")
    private String pDescription;
    @Basic(optional = false)
    @Column(name = "p_name")
    private String pName;
    @Basic(optional = false)
    @Column(name = "p_property")
    private int pProperty;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<RequirePatch> requirePatchList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<ManagerPlan> managerPlanList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<Milestone> milestoneList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<ProjectProblem> projectProblemList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<ProjectResource> projectResourceList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<RiskCategory> riskCategoryList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "project", fetch = FetchType.LAZY)
    private List<Require> requireList;

    public Project() {
    }

    public Project(Integer pId) {
        this.pId = pId;
    }

    public Project(Integer pId, String pName, int pProperty) {
        this.pId = pId;
        this.pName = pName;
        this.pProperty = pProperty;
    }

    public Integer getPId() {
        return pId;
    }

    public void setPId(Integer pId) {
        this.pId = pId;
    }

    public String getPDescription() {
        return pDescription;
    }

    public void setPDescription(String pDescription) {
        this.pDescription = pDescription;
    }

    public String getPName() {
        return pName;
    }

    public void setPName(String pName) {
        this.pName = pName;
    }

    public int getPProperty() {
        return pProperty;
    }

    public void setPProperty(int pProperty) {
        this.pProperty = pProperty;
    }

    public List<RequirePatch> getRequirePatchList() {
        return requirePatchList;
    }

    public void setRequirePatchList(List<RequirePatch> requirePatchList) {
        this.requirePatchList = requirePatchList;
    }

    public List<ManagerPlan> getManagerPlanList() {
        return managerPlanList;
    }

    public void setManagerPlanList(List<ManagerPlan> managerPlanList) {
        this.managerPlanList = managerPlanList;
    }

    public List<Milestone> getMilestoneList() {
        return milestoneList;
    }

    public void setMilestoneList(List<Milestone> milestoneList) {
        this.milestoneList = milestoneList;
    }

    public List<ProjectProblem> getProjectProblemList() {
        return projectProblemList;
    }

    public void setProjectProblemList(List<ProjectProblem> projectProblemList) {
        this.projectProblemList = projectProblemList;
    }

    public List<ProjectResource> getProjectResourceList() {
        return projectResourceList;
    }

    public void setProjectResourceList(List<ProjectResource> projectResourceList) {
        this.projectResourceList = projectResourceList;
    }

    public List<RiskCategory> getRiskCategoryList() {
        return riskCategoryList;
    }

    public void setRiskCategoryList(List<RiskCategory> riskCategoryList) {
        this.riskCategoryList = riskCategoryList;
    }

    public List<Require> getRequireList() {
        return requireList;
    }

    public void setRequireList(List<Require> requireList) {
        this.requireList = requireList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pId != null ? pId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Project)) {
            return false;
        }
        Project other = (Project) object;
        if ((this.pId == null && other.pId != null) || (this.pId != null && !this.pId.equals(other.pId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.Project[pId=" + pId + "]";
    }

}
